package com.moerlong.platform.service.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.moerlong.platform.service.utils.R;

//开启restful api 返回json对象
@RestController
public class JavaController {
	
	//http请求  -get  ip:端口/add？a=?&b=? 
	@RequestMapping(value = "/add", method = RequestMethod.GET)
	public R add(@RequestParam(value="a") int a, @RequestParam(value="b") int b)
	{
		return R.ok().put("result", a+b);
	}
	
	//http请求  -get  ip:端口/subtract？a=?&b=? 
	@RequestMapping(value = "/subtract", method = RequestMethod.GET)
	public R subtract(@RequestParam(value="a") int a, @RequestParam(value="b") int b)
	{
		return R.ok().put("result", a-b);
	}
}
